<?php
if(defined('IZ_ACCNAME')) {
  $opt_flags = $_SESSION['IZ_OPT'];
  if(($_SESSION['edit'] > 0) || ($_SESSION['cpanel'] == 1)) {
    $jsfoot .= 'tinyMCE.init({
    	mode : "specific_textareas",
      editor_selector : "mceEditor",
    	plugins : "inlinepopups,emotions",
    	theme : "advanced",
    	skin : "o2k7",
  	  skin_variant: "'.($_SESSION['IZ_CURTHEME'] == 'charcoal' ? 'black' : 'silver').'",';
    if($colwidth == 'wide') {
      $jsfoot .= 'theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,fontselect,fontsizeselect,|,hr,removeformat,emotions,|,cut,copy,paste,pastetext,|,bullist,numlist,|,undo,redo,|,link,unlink,cleanup,|,forecolor,backcolor",
                 theme_advanced_buttons2 : "",';
    } else {
      $jsfoot .= 'theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,fontselect,fontsizeselect,|,hr,removeformat,emotions",
                 theme_advanced_buttons2 : "cut,copy,paste,pastetext,|,bullist,numlist,|,undo,redo,|,link,unlink,cleanup,|,forecolor,backcolor",';
    }
    $jsfoot .= 'theme_advanced_buttons3: "",
    	theme_advanced_toolbar_location : "top",
    	theme_advanced_toolbar_align : "left",
    	theme_advanced_fonts : "Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Times New Roman=times new roman",
    	theme_advanced_font_sizes : "1,3,5",
    	theme_advanced_more_colors : false,
      valid_elements : "a[href|target=_blank],strong/b,em/i,br,span[style],p,ol,ul,li,img[src|alt|title|class]",
    	button_tile_map : true,
    	content_css: "'.$_SESSION['IZ_CALURL'].'includes/lib/tiny_mce/custom.css",
    	cleanup : true
   });'."\n";
  if(($opt_flags & OPT_RECURRENCE) != 0) {
    $onload .= 'listen(\'click\',\'rnone\',hideall);'."\n".
               'listen(\'click\',\'rdaily\',showobjfunc(\'daily\',\'weekly\',\'monthly\',\'yearly\'));'."\n".
               'listen(\'click\',\'rweekly\',showobjfunc(\'weekly\',\'daily\',\'monthly\',\'yearly\'));'."\n".
               'listen(\'click\',\'rmonthly\',showobjfunc(\'monthly\',\'daily\',\'weekly\',\'yearly\'));'."\n".
               'listen(\'click\',\'ryearly\',showobjfunc(\'yearly\',\'daily\',\'weekly\',\'monthly\'));'."\n".
               'listen(\'click\',\'xdays\',togglecheck(\'everyxdays\',true));'."\n".
               'listen(\'click\',\'xmonthday\',togglecheck(\'dayxofy\',true));'."\n".
               'listen(\'click\',\'xmonthmonths\',togglecheck(\'dayxofy\',true));'."\n".
               'listen(\'click\',\'xmonthmonths2\',togglecheck(\'dayxofyeveryz\',true));'."\n".
               'listen(\'click\',\'monthinterval\',togglecheck(\'dayxofyeveryz\',true));'."\n".
               'listen(\'click\',\'monthinttype\',togglecheck(\'dayxofyeveryz\',true));'."\n".
               'listen(\'click\',\'yearlydate\',togglecheck(\'yeartype1\',true));'."\n".
               'listen(\'click\',\'yearrecmonth\',togglecheck(\'yeartype1\',true));'."\n".
               'listen(\'click\',\'yearrecint\',togglecheck(\'yeartype2\',true));'."\n".
               'listen(\'click\',\'yearrectype\',togglecheck(\'yeartype2\',true));'."\n".
               'listen(\'click\',\'yearrecmonth2\',togglecheck(\'yeartype2\',true));'."\n".
               'listen(\'click\',\'numrecurrences\',togglecheck(\'rectype1\',true));'."\n".
               'listen(\'click\',\'rendby\',togglecheck(\'rectype3\',true));'."\n";
    $cals .= 'Calendar.setup({inputField:"rendby",button:"rendbymousehook",displayArea:"rendbymousehook",firstDay:JS_FIRSTDAY,onUpdate:function() {document.getElementById(\'rectype3\').checked = true}});'."\n";
  }
  if(($opt_flags & OPT_ENDDATE) != 0) {
    $cals .= 'Calendar.setup({inputField:"addevstartdate",displayArea:"addevstartmousehook",button:"addevstartmousehook",firstDay:JS_FIRSTDAY,onUpdate:function() {document.getElementById(\'addevenddate\').value = document.getElementById(\'addevstartdate\').value}});'."\n".
             'Calendar.setup({inputField:"addevenddate",displayArea:"addevendmousehook",button:"addevendmousehook",firstDay:JS_FIRSTDAY});'."\n";
    $onload .= 'listen(\'click\',\'addevallday\',setalldayfunc(\'main\',\'add\'));'."\n";
  } else {
    $cals .= 'Calendar.setup({inputField:"addevstartdate",displayArea:"addevstartmousehook",button:"addevstartmousehook",firstDay:JS_FIRSTDAY});'."\n";
  }
  if(($opt_flags & OPT_TODO) != 0) {
    if($_GET['act'] != 'add') {
      $onload .= 'listen(\'click\',\'tabaddtask\',showtabfunc(\'addtask\',\'addevent\',\'importical\',\'tabaddtask\'));'."\n".
                 'listen(\'click\',\'addtodocancelbutton\',addlink(\'phase\',\'calwrapper\',\'addform\'));'."\n".
                 'listen(\'click\',\'importicalcancelbutton\',addlink(\'phase\',\'calwrapper\',\'addform\'));'."\n".
                 'listen(\'click\',\'addtaskongoing\',ongoingfunc(\'main\',\'add\'));'."\n";
    }
    $cals .= 'Calendar.setup({inputField:"addtaskdatedue",button:"addtaskdateduehook",displayArea:"addtaskdateduehook",firstDay:JS_FIRSTDAY});'."\n";
    if(($opt_flags & OPT_CATEGORY) != 0) {
      $onload .= 'listen(\'click\',\'addtaskcategory\',addnewcatfunc(\'todo\',\'add\'));'."\n";
    }
  }
  if(($opt_flags & OPT_CATEGORY) != 0) {
    $onload .= 'listen(\'click\',\'addevcategory\',addnewcatfunc(\'event\',\'add\'));'."\n";
  }
  ?>
  <div class="tabs" id="addform"<?php if($_GET['act'] != 'add') {
  $onload .= 'listen(\'click\',\'addcancelbutton\',addlink(\'phase\',\'calwrapper\',\'addform\'));'."\n".
             'listen(\'click\',\'tabaddevent\',showtabfunc(\'addevent\',\'addtask\',\'importical\',\'tabaddevent\'));'."\n".
             'listen(\'click\',\'tabimportical\',showtabfunc(\'importical\',\'addevent\',\'addtask\',\'tabimportical\'));'."\n";
  ?> style="display: none;">
    <ul class="tabmenu" id="addmenu">
      <li><a href="#eventadd" id="tabaddevent" class="activetab"><?php echo STR_ADDEVENT; ?></a></li>
      <?php if(($opt_flags & OPT_TODO) != 0) { ?>
        <li><a href="#taskadd" id="tabaddtask" class="inactivetab"><?php echo STR_ADDTASK; ?></a></li>
      <?php } ?>
      <li><a href="#icalimport" id="tabimportical" class="inactivetab"><?php echo STR_IMPORTICAL; ?></a></li>
    </ul><?php } else { echo '>'; } ?>
    <div class="tabcontainer">
      <div id="addevent">
          <form enctype="multipart/form-data" method="post" action="<?php echo $_SESSION['IZ_CALURL']; ?>index.php" id="addeventform" name="addeventform" onsubmit="return validate_event('add');">
              <label for="addevtitle"><?php echo STR_EVENTNAME; ?>&#58;</label>
              <input type="text" name="addevtitle" tabindex="1" id="addevtitle" class="standard" size="30" />
              <div class="inlineerror" id="addeverror_title">&nbsp;</div><br />
        
              <?php if(($opt_flags & OPT_ENDDATE) != 0) { ?>
                  <label for="addevstartbox"><?php echo STR_STARTS; ?>&#58;<br />
                      <small><?php echo STR_ALLDAYINST; ?></small>
                  </label>

                  <div class="datebox" id="addevstartbox">
                      <div class="dateinput">
                        <input type="text" name="addevstartdate" tabindex="2" size="10" id="addevstartdate" class="standard" value="<?php if(!empty($_GET['adddate'])) { echo str_replace('-','/',$_GET['adddate']); } else { echo date("j/m/Y",mktime()); } ?>" />
                        <img src="<?php echo $_SESSION['IZ_CALURL']; ?>images/calendar.png" class="datepicker" alt="<?php echo STR_PICKSTART; ?>" id="addevstartmousehook" />
                      </div>
                      <div class="dateinput">
                          <input type="text" name="addevstarthour" tabindex="3" size="2" id="addevstarthour" class="small" value="00" disabled="disabled" />
                          &#58;
                          <input type="text" name="addevstartminute" tabindex="4" size="2" id="addevstartminute" class="small" value="00" disabled="disabled" />
                      </div>
                      <div><input type="checkbox" name="addevallday" tabindex="5" id="addevallday" class="inlinecheck" value="1" checked="checked" /><label for="addevallday"><?php echo STR_ALLDAYDESC; ?></label></div>
                      <div class="inlineerror" id="addeverror_start">&nbsp;</div>
                      <div class="inlineerror" id="addeverror_allday" style="padding-top: 2px;">&nbsp;</div>
                  </div>
                  <br />

                  <label for="addevendbox"><?php echo STR_ENDS; ?>&#58;</label>
                  <div class="datebox" id="addevendbox">
                      <div class="dateinput">
                        <input type="text" name="addevenddate" tabindex="6" size="10" id="addevenddate" class="standard" value="<?php if(isset($_GET['adddate'])) { echo str_replace('-','/',$_GET['adddate']); } else { echo date("j/m/Y",mktime()); } ?>" />
                        <img src="<?php echo $_SESSION['IZ_CALURL']; ?>images/calendar.png" class="datepicker" alt="<?php echo STR_PICKEND; ?>" id="addevendmousehook" />
                      </div>
                      <div class="dateinput">    
                          <input type="text" name="addevendhour" tabindex="7" size="2" id="addevendhour" class="small" value="00" disabled="disabled" />
                          &#58;
                          <input type="text" name="addevendminute" tabindex="8" size="2" id="addevendminute" class="small" value="00" disabled="disabled" />
                      </div>                        
                      <div class="inlineerror" id="addeverror_end">&nbsp;</div>
                  </div><br />
              <?php } else { ?>
                  <label for="addevstartbox"><?php echo STR_DATE; ?>&#58;</label>

                  <div class="datebox" id="addevstartbox">
                      <div class="dateinput">
                        <input type="text" name="addevstartdate" tabindex="2" size="10" id="addevstartdate" class="standard" value="<?php if(isset($_GET['adddate'])) { echo str_replace('-','/',$_GET['adddate']); } else { echo date("j/m/Y",mktime()); } ?>" />
                        <img src="<?php echo $_SESSION['IZ_CALURL']; ?>images/calendar.png" class="datepicker" alt="<?php echo STR_PICKSTART; ?>" id="addevstartmousehook" />
                      </div>
                      <div class="inlineerror" id="addeverror_start">&nbsp;</div>
                  </div><br />
              <?php } ?>
        
              <label for="addevtask"><?php echo STR_DESCRIPTION; ?>&#58;</label>
              <textarea rows="15" name="addevtask" tabindex="9" id="addevtask" class="standard mceEditor" cols="60"></textarea><br />
  
              <?php if(($opt_flags & OPT_ATTENDEES) != 0) { ?>
              <label for="addevattendees"><?php echo STR_ATTENDEES; ?>&#58;<br />
              <small><?php echo STR_ATTENDEESINST; ?></small></label>
              <textarea rows="4" cols="30" name="addevattendees" tabindex="10" id="addevattendees" class="standard"></textarea><br />
              <?php } ?>
  
              <?php if($_SESSION['cust1'] != 'none') { ?>
              <label for="addevcust1"><?php echo $_SESSION['cust1']; ?>&#58;</label>
              <input type="text" name="addevcust1" tabindex="11" id="addevcust1" size="50" class="standard" /><br />
  
              <?php } if($_SESSION['cust2'] != 'none') { ?>
              <label for="addevcust2"><?php echo $_SESSION['cust2']; ?>&#58;</label>
              <input type="text" name="addevcust2" tabindex="12" id="addevcust2" size="50" class="standard" /><br />
  
              <?php } if($_SESSION['cust3'] != 'none') { ?>
              <label for="addevcust3"><?php echo $_SESSION['cust3']; ?>&#58;</label>
              <input type="text" name="addevcust3" tabindex="13" id="addevcust3" size="50" class="standard" /><br />
              <?php } ?>
  
              <?php if(($opt_flags & OPT_VENUE) != 0) { ?>
              <label for="addevvenue"><?php echo STR_VENUE; ?>&#58;</label>
              <input type="text" name="addevvenue" tabindex="14" id="addevvenue" size="30" class="standard" /><br />
                <?php if(($opt_flags & OPT_GOOGLE) != 0) { ?>
                    <div class="datebox">
                      <input type="checkbox" name="addevlinkgoogle" id="addevlinkgoogle" class="optioncheck" tabindex="15" value="1" />
                      <label for="addevlinkgoogle"><?php echo STR_LINKGOOGLE; ?></label>
                    </div><br />
                <?php } 
              } ?>
  
              <?php if(($opt_flags & OPT_CATEGORY) != 0) { ?>
              <label for="addevcategory"><?php echo STR_CATEGORY; ?>&#58;</label>
              <select name="addevcategory" id="addevcategory" tabindex="16" size="1">
              <?php get_categories('edit',$_SESSION['defaultcategoryevents'],'event'); ?>
              <option id="addnewcatevent" value="newcat"><?php echo STR_NEWCATEGORY; ?></option>
              </select><br />
              <?php } else { ?>
              <input type="hidden" name="addevcategory" id="addevcategory" value="<?php echo $_SESSION['defaultcategoryevents']; ?>" />
              <?php } ?>
              
              <?php if(($opt_flags & OPT_ICON) != 0) { ?>
              <label><?php echo STR_ICON; ?>&#58;</label>
              <div class="icon-box">
              <?php get_icons('add','event'); ?>
              </div><br />
              <?php } ?>
              
              <?php if($_SESSION['authed'] == 1) { ?>
              <label><?php echo STR_EVENTSTATUS; ?>&#58;</label>
              <div class="checks">
                <input type="radio" value="Public" name="addevstatus" tabindex="17" class="nomargin" id="addevpublicstatus"<?php if($_SESSION['defaultstatus'] == 'Public') { echo ' checked="checked"'; } ?> /><label for="addevpublicstatus" class="plain"><?php echo STR_STATUSPUBLIC; ?></label>
                <input type="radio" value="Private" name="addevstatus" tabindex="18" class="nomargin" id="addevprivatestatus"<?php if($_SESSION['defaultstatus'] == 'Private') { echo ' checked="checked"'; } ?> /><label for="addevprivatestatus" class="plain"><?php echo STR_STATUSPRIVATE; ?></label>
              </div><br />
            <?php } else { ?>
                <input type="hidden" name="addevstatus" value="Public" />
            <?php } if($_SESSION['IZ_ALLOWCOMMENTS'] == 'author') { ?>
                <label><?php echo STR_ALLOWCOMMENTS; ?>&#58;</label>
                <div><input type="checkbox" name="addevallowcomments" id="addevallowcomments" class="inlinecheck" tabindex="19" value="1" />
                <label for="addevallowcomments" class="plain"><?php echo STR_ENABLED; ?></label></div><br />
            <?php } ?>
                      
            <?php if(($opt_flags & OPT_RECURRENCE) != 0) { ?>
                <label for="recurrence"><?php echo STR_RECURRENCE; ?>&#58;</label>
                <div id="recurrence">
                    <input type="radio" value="none" name="recurs" id="rnone" checked="checked" /><label for="rnone"><?php echo STR_NONE; ?></label>
                    <input type="radio" value="daily" name="recurs" id="rdaily" /><label for="rdaily"><?php echo STR_DAILY; ?></label>
                    <input type="radio" value="weekly" name="recurs" id="rweekly" /><label for="rweekly"><?php echo STR_WEEKLY; ?></label>
                    <input type="radio" value="monthly" name="recurs" id="rmonthly" /><label for="rmonthly"><?php echo STR_MONTHLY; ?></label>
                    <input type="radio" value="yearly" name="recurs" id="ryearly" /><label for="ryearly"><?php echo STR_YEARLY; ?></label>
                    
                    <div id="daily" style="display: none;">
                        <input type="radio" value="everyweekday" checked="checked" name="dayperiod" id="everyweekday" /><label for="everyweekday"><?php echo STR_WEEKDAY; ?></label><br />
                        <input type="radio" value="everyxdays" name="dayperiod" id="everyxdays" /><label for="everyxdays"><?php echo STR_EVERY; ?> </label><input type="text" name="xdays" size="2" id="xdays" class="small" /> <?php echo STR_DAYS; ?>
                        <div class="errornomargin" id="adderror_xdays">&nbsp;</div>
                    </div>
          
                    <div id="weekly">
                      <?php echo STR_RECUREVERY; ?> <input type="text" name="xweeks" size="2" value="1" class="small" /> <?php echo STR_WEEKSON; ?>&#58;<br />
                      <label for="recursunday"><input type="checkbox" name="recursunday" id="recursunday" value="1" /><?php echo $daynames[0]; ?></label>   
                      <label for="recurmonday"><input type="checkbox" name="recurmonday" id="recurmonday" value="1" /><?php echo $daynames[1]; ?></label>
                      <label for="recurtuesday"><input type="checkbox" name="recurtuesday" id="recurtuesday" value="1" /><?php echo $daynames[2]; ?></label>
                      <label for="recurwednesday"><input type="checkbox" name="recurwednesday" id="recurwednesday" value="1" /><?php echo $daynames[3]; ?></label>
                      <label for="recurthursday"><input type="checkbox" name="recurthursday" id="recurthursday" value="1" /><?php echo $daynames[4]; ?></label>
                      <label for="recurfriday"><input type="checkbox" name="recurfriday" id="recurfriday" value="1" /><?php echo $daynames[5]; ?></label>
                      <label for="recursaturday"><input type="checkbox" name="recursaturday" id="recursaturday" value="1" /><?php echo $daynames[6]; ?></label>
                    </div>
          
                    <div id="monthly">
                      <input type="radio" name="monthtype" value="dayxofy" id="dayxofy" /><?php echo STR_DAY; ?> <input type="text" name="xmonthday" size="2" id="xmonthday" class="small" /> <?php echo STR_OFEVERY; ?> <input type="text" name="xmonthmonths" size="2" value="1" id="xmonthmonths" class="small" /> <?php echo STR_MONTHS; ?><br />
                      <input type="radio" name="monthtype" value="dayxofyeveryz" id="dayxofyeveryz" /><?php echo STR_THE; ?> <select size="1" name="monthinterval" id="monthinterval">
                      <option selected="selected" value="1"><?php echo $ordinal[1]; ?></option>
                      <option value="2"><?php echo $ordinal[2]; ?></option>
                      <option value="3"><?php echo $ordinal[3]; ?></option>
                      <option value="4"><?php echo $ordinal[4]; ?></option>
                      <option value="last"><?php echo $ordinal[0]; ?></option>
                      </select>&nbsp;
                      <select size="1" name="monthinttype" id="monthinttype">
                      <?php for($m=0;$m<7;$m++) {
                              echo '<option value="',$m,'">',$daynames[$m],'</option>';
                            }
                       ?>
                        <option value="day"><?php echo STR_DAY; ?></option>
                      </select>
                      <?php echo STR_OFEVERY; ?> <input type="text" name="xmonthmonths2" size="2" value="1" id="xmonthmonths2" class="small" /> <?php echo STR_MONTHS; ?>.
                    </div>
            
                    <div id="yearly">
                      <input type="radio" name="yeartype" value="yeartype1" id="yeartype1" /><label for="yeartype1"><?php echo STR_EVERY; ?> </label>
                      <select size="1" name="yearrecmonth" id="yearrecmonth">
                        <?php for($m=1;$m<=12;$m++) {
                          echo '<option value="',$m,'">',$monthnames[$m],'</option>';
                        } ?>
                      </select>
                      <input type="text" name="yearlydate" id="yearlydate" size="2" class="small" /><br />
                      <div class="errornomargin" id="adderror_recyear">&nbsp;</div>
                      <input type="radio" name="yeartype" value="yeartype2" id="yeartype2" /><?php echo STR_THE; ?>
                      <select size="1" name="yearrecint" id="yearrecint">
                      <option selected="selected" value="1"><?php echo $ordinal[1]; ?></option>
                      <option value="2"><?php echo $ordinal[2]; ?></option>
                      <option value="3"><?php echo $ordinal[3]; ?></option>
                      <option value="4"><?php echo $ordinal[4]; ?></option>
                      <option value="last"><?php echo $ordinal[0]; ?></option>
                      </select> 
                      <select size="1" name="yearrectype" id="yearrectype">
                        <?php
                          for($m=0;$m<7;$m++) {
                            echo '<option value="',$m,'">',$daynames[$m],'</option>';
                          } ?>
                        <option value="day"><?php echo STR_DAY; ?></option>
                      </select> <?php echo STR_OF; ?>
                      <select size="1" name="yearrecmonth2" id="yearrecmonth2">
                        <?php for($m=1;$m<=12;$m++) {
                          echo '<option value="',$m,'">',$monthnames[$m],'</option>';
                        } ?>
                      </select>
                    </div>
                    <br /><br />
                    <div id="recurtime">
                      <input type="radio" name="rectype" value="1" id="rectype1" /><?php echo STR_RECTYPE1; ?> <input type="text" name="numrecurrences" size="2" id="numrecurrences" class="small" /> <?php echo STR_OCCURANCES; ?><br />
                      <div class="errornomargin" id="adderror_rec1">&nbsp;</div>
                      <input type="radio" name="rectype" value="2" id="rectype2" checked="checked" /><label for="rectype2"><?php echo sprintf(STR_RECTYPE2,$_SESSION['IZ_DEFNUMRECS']); ?></label><br />
                      <input type="radio" name="rectype" value="3" id="rectype3" /><label for="rectype3"><?php echo STR_RECTYPE3; ?>&#58;</label>
                      <input type="text" name="rendby" id="rendby" size="10" class="nomargin" value="<?php echo date("j/m/Y",mktime()); ?>" /><img src="<?php echo $_SESSION['IZ_CALURL']; ?>images/calendar.png" alt="<?php echo STR_RECTYPE3; ?>" id="rendbymousehook" /><br />
                      <div class="errornomargin" id="adderror_rec3">&nbsp;</div>
                    </div>
                </div> <!-- end recurrance -->
            <?php } else { ?>
                <input type="hidden" value="none" name="recurs" />
            <?php } ?>
            <div class="actions">
              <?php if($_GET['act'] != 'add') { ?>
              <input type="button" name="close" value="<?php echo STR_CANCEL; ?>" class="buttondelete" id="addcancelbutton" />
              <?php } ?>
              <button type="submit" value="1" tabindex="19" name="events" class="buttonsave"><?php echo STR_SAVE; ?></button>
            </div>
            <input type="hidden" name="act" value="addevent" />
            <input type="hidden" name="from" value="<?php echo str_replace(array("=","&"),array("-","."),$_SERVER['QUERY_STRING']); ?>" />
          </form>
      </div><!-- end addevent -->
      <?php if(($opt_flags & OPT_TODO) != 0) { ?>
      <div id="addtask">
          <form enctype="multipart/form-data" method="post" action="<?php echo $_SESSION['IZ_CALURL']; ?>index.php" id="addtodo" name="addtodo" onsubmit="return validate_todo('add');">
                <label for="addtaskname"><?php echo STR_TASKNAME; ?>&#58;</label>
                <input type="text" name="addtaskname" tabindex="20" id="addtaskname" class="standard" size="30" />
                <div class="inlineerror" id="addtaskerror_taskname">&nbsp;</div><br />
        
                <label for="addtaskdatedue"><?php echo STR_DATEDUE; ?>&#58;</label>
                <div class="datebox">
                  <input type="text" name="addtaskdatedue" tabindex="21" size="10" id="addtaskdatedue" class="standard" value="<?php if(isset($_GET['adddate'])) { echo str_replace('-','/',$_GET['adddate']); } else { echo date("j/m/Y",mktime()+604800); } ?>" /><img src="<?php echo $_SESSION['IZ_CALURL']; ?>images/calendar.png" class="datepicker" id="addtaskdateduehook" alt="<?php echo STR_DATEDUE; ?>" />
                </div><br />
                <div class="datebox">
                  <input type="checkbox" name="addtaskongoing" id="addtaskongoing" class="optioncheck" tabindex="22" value="1" />
                  <label for="addtaskongoing" class="plain"><?php echo STR_ONGOING; ?></label>
                </div><br />
                <div class="inlineerror" id="addtaskerror_datedue">&nbsp;</div>
                <br />
                   <?php if($_SESSION['IZ_ALLOWCOMMENTS'] == 'author') { ?>
                  <label><?php echo STR_ALLOWCOMMENTS; ?>&#58;</label>
                  <div><input type="checkbox" name="addtaskallowcomments" id="addtaskallowcomments" class="inlinecheck" tabindex="19" value="1" />
                    <label for="addtaskallowcomments" class="plain"><?php echo STR_ENABLED; ?></label></div><br />
                <?php } ?>
                <label for="addtaskdesc"><?php echo STR_TASK; ?>&#58;</label>
                <textarea rows="10" name="addtask" tabindex="23" id="addtaskdesc" class="standard mceEditor" cols="40"></textarea><br />
  
                <?php if(($opt_flags & OPT_CATEGORY) != 0) { ?>
                <label for="addtaskcategory"><?php echo STR_CATEGORY; ?>&#58;</label>
                <select name="addtaskcategory" id="addtaskcategory" tabindex="25" size="1">
                <?php get_categories('edit',$_SESSION['defaultcategorytasks'],'task'); ?>
                <option id="addnewcattodo" value="newcat"><?php echo STR_NEWCATEGORY; ?></option>
                </select>
                
                <?php } if(($opt_flags & OPT_ICON) != 0) { ?>
                <label><?php echo STR_ICON; ?>&#58;</label>
                <div class="icon-box">
                <?php get_icons('add','task'); ?>
                </div><br /><br />
                <?php } if($_SESSION['authed'] == 1) { ?>
                <label><?php echo STR_TASKSTATUS; ?>&#58;</label>
                <div class="checks">
                    <input type="radio" value="Public" name="addtaskstatus" tabindex="28" class="nomargin" id="addtaskpublicstatus"<?php if($_SESSION['defaultstatus'] == 'Public') { echo ' checked="checked"'; } ?> /><label for="addtaskpublicstatus" class="plain"><?php echo STR_STATUSPUBLIC; ?></label>
                    <input type="radio" value="Private" name="addtaskstatus" tabindex="29" class="nomargin" id="addtaskprivatestatus"<?php if($_SESSION['defaultstatus'] == 'Private') { echo ' checked="checked"'; } ?> /><label for="addtaskprivatestatus" class="plain"><?php echo STR_STATUSPRIVATE; ?></label>
                </div><br />
                <?php } else { ?>
                          <input type="hidden" name="addtaskstatus" value="Public" />
                <?php } ?>
                
                <br />
        
                <?php if($_SESSION['cust1'] != 'none') { ?>
                <label for="addtaskcust1"><?php echo $_SESSION['cust1']; ?>&#58;</label>
                <input type="text" name="addtaskcust1" tabindex="32" id="addtaskcust1" size="50" class="standard" /><br />
        
                <?php } if($_SESSION['cust2'] != 'none') { ?>
                <label for="addtaskcust2"><?php echo $_SESSION['cust2']; ?>&#58;</label>
                <input type="text" name="addtaskcust2" tabindex="33" id="addtaskcust2" size="50" class="standard" /><br />
        
                <?php } if($_SESSION['cust3'] != 'none') { ?>
                <label for="addtaskcust3"><?php echo $_SESSION['cust3']; ?>&#58;</label>
                <input type="text" name="addtaskcust3" tabindex="34" id="addtaskcust3" size="50" class="standard" /><br />
                <?php } ?>      
          <div class="actions">
            <?php if($_GET['act'] != 'add') { ?>
              <input type="button" name="close" value="<?php echo STR_CANCEL; ?>" class="buttondelete" id="addtodocancelbutton" />
            <?php } ?>
            <button type="submit" value="save" tabindex="36" name="store" class="buttonsave"><?php echo STR_SAVE; ?></button>
          </div>      
          <input type="hidden" name="todo" value="add" />
          <input type="hidden" name="from" value="<?php echo str_replace(array("=","&"),array("-","."),$_SERVER['QUERY_STRING']); ?>" />
          </form>    
      </div><!-- end add task -->
      <?php } ?>
      <div id="importical">
          <form enctype="multipart/form-data" method="post" action="<?php echo $_SESSION['IZ_CALURL']; ?>index.php" name="import">
            <label for="icsfile"><?php echo STR_CHOOSEFILE; ?>&#58;</label>
            <input type="file" name="icsfile" class="nicebutton" /><br />
            <div class="actions">
              <?php if($_GET['act'] != 'add') { ?>
                <input type="button" name="close" value="<?php echo STR_CANCEL; ?>" class="buttondelete" id="importicalcancelbutton" />
              <?php } ?>
              <button type="submit" value="importical" name="act" class="buttonsave"><?php echo STR_IMPORT; ?></button>
            </div> 
          <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
          <input type="hidden" name="import" value="ical" />
          <input type="hidden" name="from" value="<?php echo str_replace(array("=","&"),array("-","."),$_SERVER['QUERY_STRING']); ?>" />
          </form>
      </div><!-- end import ical -->
    </div><!-- end add container -->  
  </div><!-- end add -->
<?php
  } // Can't view
} else {
  // Directly accessed
  header('Location: ../');
} ?>